export default {
  state:{
    pointFilterOfCarType:[],
    pointFilterOfAdminCode:[],
    curPosition:{}
  },
  mutations:{
    updateCarTypeFilter(state,payload){
      state.pointFilterOfCarType = payload.filter;
    },
    updateAdminFilter(state,payload){
      state.pointFilterOfAdminCode = payload.filter;
    },
    updatePosition(state,payload){
      state.curPosition = payload;
    }
  },
  getters:{
    pointFilter(state){
      let filter = ['all'];
      let carFLen = state.pointFilterOfCarType.length;
      let adFLen = state.pointFilterOfAdminCode.length;

      if(carFLen>2) {
        filter.push(state.pointFilterOfCarType)
      }
      if(adFLen>2){
        filter.push(state.pointFilterOfAdminCode)
      }
      if(carFLen<=2 && adFLen<=2){
        filter = null;
      }
      return filter
    }
  }

}
